<template>
  <tr>
    <td><input
        type="checkbox"
        v-model="obj.checked"
      ></td>
    <td>{{obj.name}}</td>
    <td>{{obj.price}}</td>
    <td>
      <button @click="reduceBtn(index)">-</button>
      {{obj.num}}
      <button @click="addBtn(index)">+</button>
    </td>
    <td>{{obj.price * obj.num}}</td>
    <td><button @click="delBtn(index)">删除</button></td>
  </tr>

</template>

<script>
export default {
  props: ['obj', 'index'],
  methods: {
    addBtn (index) {
      this.$emit('add', index)
    },
    reduceBtn (index) {
      this.$emit('reduce', index)
    },
    delBtn (index) {
      this.$emit('del', index)
    }
  }
}
</script>

<style>
tr {
  width: 900px;
}
</style>